package com.bw.inspection.adapter

import android.graphics.Color
import android.widget.TextView
import com.bw.inspection.R
import com.bw.inspection.entity.InspectionEntity
import com.bw.inspection.entity.InspectionEntityItem
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder


class InspectionAdapter: BaseQuickAdapter<InspectionEntityItem, BaseViewHolder>(R.layout.item_inspection_point) {
    override fun convert(holder: BaseViewHolder, item: InspectionEntityItem) {
        holder.setText(R.id.in_name,item.pointName)
        holder.getView<TextView>(R.id.inspection_address).text = item.pointName
        holder.getView<TextView>(R.id.inspection_status).text = "启动"
        val static = holder.getView<TextView>(R.id.inspection_type)
        static.text = item.patrolType
        if (item.patrolType == "保洁巡检"){
            static.text = "保洁巡检"
            static.setBackgroundResource(R.drawable.device_zt2)
            static.setTextColor(Color.WHITE)
        }else if (item.patrolType == "安防巡检"){
            static.setBackgroundResource(R.drawable.device_zt1)
            static.text = "安防巡检"
            static.setTextColor(Color.WHITE)
        }else if (item.patrolType == "家居巡检"){
            static.text = "家居巡检"
            static.setBackgroundResource(R.drawable.device_zt4)
            static.setTextColor(Color.WHITE)
        }else if (item.patrolType == "日常巡检"){
            static.text = "日常巡检"
            static.setBackgroundResource(R.drawable.device_zt3)
            static.setTextColor(Color.WHITE)
        }
    }

}